<template>
  <div>
      <column-list :list="testData"></column-list>
  </div>
</template>

<script lang='ts'>
/* 使用vuex axios获取数据 */
import {defineComponent,computed,onMounted} from 'vue'
import ColumnList from '@/components/ColumnList/ColumnList.vue'

import {useStore} from 'vuex'
import {GlobalDataProps} from '@/store/index'

export default defineComponent({
  components: {
    ColumnList
  },
  setup(){
    // 为了能够更好的提示，我们这里使用泛型
    const store = useStore<GlobalDataProps>()

    onMounted(() => {
      // 经过此方式，把请求到的数据赋值给columns
      store.dispatch('fetchColumns')
    })
   // 然后
    const list = computed(()=>  store.state.columns)

    return {
      testData:list
    }
  }
})
</script>

<style>

</style>